package com.wjerp.tplus.server.common.constant;

/**
 * 权限定义模块
 * @author lishuailei
 */
public enum  RolePermission {
	
	//匿名用户
	ANONYMOUS("ROLE_ANONYMOUS"),

    //商户
    MERCHANT("ROLE_merchant"),
    //商户管理员
    ADMIN_MERCHANT("ROLE_admin_merchant"),
    ADMIN_MERCHANT_CREATE("ROLE_admin_merchant_c"),
    ADMIN_MERCHANT_UPDATE("ROLE_admin_merchant_u"),
    ADMIN_MERCHANT_DELETE("ROLE_admin_merchant_d"),
    ADMIN_MERCHANT_READ("ROLE_admin_merchant"),
    ADMIN_MERCHANT_AUDITING("ROLE_admin_merchant_auditing");

    private String key;


    private RolePermission(String key) {
        this.key = key;
    }


    public String getKey() {
        return key;
    }


    /**
     * Resolve.
     *
     * @param key the key
     * @return the error detail
     */
    public static RolePermission resolve(String key) {
        for (RolePermission item : values()) {
            if (item.getKey().equalsIgnoreCase(key)) {
                return item;
            }
        }
        return null;
    }
}
